﻿package mortal.game.view.combinedServer.exp
{
    import com.mui.controls.*;
    import extend.language.*;
    import flash.events.*;
    import mortal.common.*;
    import mortal.common.global.*;
    import mortal.game.events.*;
    import mortal.game.mvc.*;
    import mortal.game.resource.*;
    import mortal.game.view.combinedServer.data.*;
    import mortal.game.view.common.*;
    import mortal.game.view.copy.GroupTowerCopy.data.*;
    import mortal.game.view.rebate.item.*;
    import mortal.mvc.core.*;

    public class CombinedSerExpActive extends GSprite
    {
        protected var _mbg:GImageBitmap;
        protected var _time1:GTextFiled;
        protected var _desTxt:GTextFiled;
        protected var _timeDetail:GTextFiled;
        protected var _list:CellsGridSprite;
        protected var _addBtn:GLoadingButton;

        public function CombinedSerExpActive()
        {
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._mbg = UIFactory.gImageBitmap(ImagesConst.CombinedSerExpBg, 0, 0, this);
            this._time1 = UIFactory.gTextField("", 114, 151, 320, 25, this, GlobalStyle.textFormatPutong.setColor(16777215));
            this._desTxt = UIFactory.gTextField("TextField", 51, 224, 600, 80, this, GlobalStyle.textFormatPutong.setColor(16777215));
            this._timeDetail = UIFactory.gTextField("", 46, 342, 620, 25, this, GlobalStyle.textFormatLv);
            this._list = UIFactory.getUICompoment(CellsGridSprite);
            this._list.colNum = 8;
            this._list.vCellWid = 45;
            this._list.hCellWid = 100;
            this._list.genCellFun = this.genItem;
            this._list.genCells(8);
            this._list.x = 53;
            this._list.y = 424;
            this.addChild(this._list);
            this._addBtn = UIFactory.gLoadingButton(ImagesConst.CombinedSerAddAct_upSkin, 274, 491, 141, 42, this);
            this._addBtn.label = "";
            this.updateRuleAndTime();
            this._addBtn.configEventListener(MouseEvent.CLICK, this.onEnterHd);
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            this._mbg = null;
            this._time1 = null;
            this._desTxt = null;
            this._timeDetail = null;
            this._list = null;
            this._addBtn = null;
            super.disposeImpl(param1);
            return;
        }// end function

        private function genItem() : RebateItem2
        {
            var _loc_1:* = UIFactory.getUICompoment(RebateItem2);
            return _loc_1;
        }// end function

        private function updateRuleAndTime() : void
        {
            var _loc_3:* = "" + CombinedSerUtil.getOpenTimeStr();
            this._time1.text = "" + CombinedSerUtil.getOpenTimeStr();
            this._timeDetail.text = _loc_3;
            var _loc_1:* = GlobalStyle.textFormatPutong.setColor(16777215);
            _loc_1.leading = 5;
            this._desTxt.defaultTextFormat = _loc_1;
            this._desTxt.htmlText = Language.getString(71381);
            var _loc_2:* = CombinedSerUtil.expGiftCode;
            RewardCfgUtil.updateRwListByGiftCode(_loc_2, this._list);
            return;
        }// end function

        private function onEnterHd(event:MouseEvent) : void
        {
            GameController.smallMap.view.show();
            Dispatcher.dispatchEvent(new DataEvent(EventName.SmallMapChangeTab, 2));
            return;
        }// end function

    }
}
